﻿using Sprout.Core.Utils;
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace Sprout.Core.Exceptions
{
    /// <summary>
    /// Http请求异常
    /// </summary>
    public class HttpException : Exception
    {
        public HttpException(HttpResponseMessage response)
        {
            StatusCode = response.StatusCode;
            ReasonPhrase = response.ReasonPhrase;
            Content = response.Content;
            HttpResponseMessage = response;
        }
        /// <summary>
        /// HttpResponseMessage
        /// </summary>
        public HttpResponseMessage HttpResponseMessage { get; set; }
        /// <summary>
        /// 响应的内容
        /// </summary>
        public HttpContent Content { get; set; }
        /// <summary>
        /// 状态码
        /// </summary>
        public HttpStatusCode StatusCode { get; set; }
        /// <summary>
        /// 短语
        /// </summary>
        public string ReasonPhrase { get; set; }
    }
}
